package com.robot.mirai.controller.interview;

import com.robot.mirai.controller.interview.listener.SeekersEventListener;
import com.robot.mirai.pojo.dto.SeekersUserDTO;
import com.robot.mirai.pojo.entity.interview.SeekersUser;
import com.robot.mirai.service.interview.SeekersService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ruoLi
 */
@RestController
@RequestMapping("/interview")
public class SeekersController {
    @Autowired
    SeekersService seekersService;
    @Autowired
    SeekersEventListener seekersEventListener;
    @GetMapping("")
    public void indexUser(){
        seekersEventListener.addSeekersUser();
    }
    @PostMapping("/addSeekers")
    public void addSeekersUser(@RequestBody SeekersUserDTO seekersUserDTO){
        SeekersUser seekersUser=new SeekersUser();
        BeanUtils.copyProperties(seekersUserDTO,seekersUser);
        seekersService.addSeekersUser(seekersUser);
    }
}
